package org.c41.graphics.swing;

import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JPanel;

public class JImagePanel extends JPanel {

	private Image image;

	public JImagePanel(){}
	
	public JImagePanel(Image image){
		this.image=image;
	}
	
	@Override
	public void paintComponent(Graphics g){
		if(image!=null){
			g.drawImage(image, 0, 0, getWidth(), getHeight(), null);
		}
		else{
			super.paintComponent(g);
		}
	}
	
	public void setImage(Image image){
		this.image=image;
	}
	
	public Image getImage(){
		return this.image;
	}
	
}
